package com.example.sunchuanjia_03;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class DirectPayActivity extends AppCompatActivity {
    private TextView tvProductName, tvProductPrice;
    private Button btnPayNow;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_direct_pay);

        tvProductName = findViewById(R.id.tvProductName);
        tvProductPrice = findViewById(R.id.tvProductPrice);
        btnPayNow = findViewById(R.id.btnPayNow);

        //显示商品详情
        Intent receivedIntent = getIntent();
        Intent intent1 = receivedIntent.getParcelableExtra("key2");

        if(intent1 != null)
        {
            String[] data =(String[]) intent1.getSerializableExtra("key");
            tvProductName.setText(tvProductName.getText()+data[0]);
            tvProductPrice.setText(tvProductPrice.getText()+data[1]);
        }


        //支付结果页面
        btnPayNow.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent1 = new Intent(DirectPayActivity.this, PayResultActivity.class);
                startActivity(intent1);
            }
        });


    }
}
